package lcr;

public class Test0005 {
}

class Solution0005_1 {
    public int maxProduct(String[] words) {
        int length = words.length,ans=0;
        int[] nums = new int[length];

        for (int i = 0; i < length; i++) {
            char[] charArray = words[i].toCharArray();
            for (int j = 0; j < charArray.length; j++) {
                nums[i] |= 1<<(charArray[j]-'a');
            }
        }

        for (int i = 0; i < nums.length; i++) {
            for (int j = i+1; j < length; j++) {
                if ((nums[i]&nums[j])!=0) continue;
                ans=Math.max(ans,words[i].length()*words[j].length());
            }
        }

        return ans;
    }
}
